package com.room.search.domain;

import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import javax.persistence.*;

/**
 * 小区搜索elasticsearch表
 */
@ApiModel(description = "小区搜索elasticsearch表")
@Entity
@Table(name = "room_search_community")
@org.springframework.data.elasticsearch.annotations.Document(indexName = "room_search_community")
public class RoomSearchCommunity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(name = "community_id")
    private Long community_id;

    @Column(name = "average")
    private Integer average;

    // jhipster-needle-entity-add-field - JHipster will add fields here

    public Long getId() {
        return this.id;
    }

    public RoomSearchCommunity id(Long id) {
        this.setId(id);
        return this;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCommunityId() {
        return this.community_id;
    }

    public RoomSearchCommunity communityId(Long communityId) {
        this.setCommunityId(communityId);
        return this;
    }

    public void setCommunityId(Long communityId) {
        this.community_id = communityId;
    }

    public Integer getAverage() {
        return this.average;
    }

    public RoomSearchCommunity average(Integer average) {
        this.setAverage(average);
        return this;
    }

    public void setAverage(Integer average) {
        this.average = average;
    }

    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof RoomSearchCommunity)) {
            return false;
        }
        return id != null && id.equals(((RoomSearchCommunity) o).id);
    }

    @Override
    public int hashCode() {
        // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
        return getClass().hashCode();
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "RoomCommunitySearch{" +
            "id=" + getId() +
            ", communityId=" + getCommunityId() +
            ", average=" + getAverage() +
            "}";
    }
}
